package com.yzd.netmonitor.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.slf4j.LoggerFactory;

public class PhoneUtils {

	private static final org.slf4j.Logger logger = LoggerFactory.getLogger(PhoneUtils.class);

	private static String regEx_mobile = "^(130|131|132|133|134|135|136|137|138|139|147|150|151|152|153|155|156|157|158|159|180|181|182|183|185|186|187|188|189|1700|1705|1709)";

	public static boolean isMobilePhone(String mobile) {

		Pattern regEx_number = Pattern.compile("^\\d{11}$");
		Matcher mat = regEx_number.matcher(mobile);
		if (!mat.find()) {
			return false;
		}
		Pattern pat_mobile = Pattern.compile(regEx_mobile);
		mat = pat_mobile.matcher(mobile);
		if (!mat.find()) {
			return false;
		}
		return true;
	}

	public static void main(String[] args) {

		logger.info("13810790841 is legal:{}", isMobilePhone("1333"));
	}
}
